package kr.hkit.powerjava.chapter10;

import javax.swing.JOptionPane;

public class ArrayTest1 {
	public static void main(String[] args) {
		final int STUDENTS = 5;
		int total = 0;
		
		int[] arrScores = new int[STUDENTS];
		System.out.println(arrScores.length);
		
		for(int i = 0; i < arrScores.length; i++){
			/*String res = JOptionPane.showInputDialog("점수 입력");
			arrScores[i] = Integer.parseInt(res);*/
			
//			arrScores[i] = Integer.parseInt(JOptionPane.showInputDialog("점수를 입력하시오"));
			arrScores[i] = i+1;
		}
		
	/*	prnArray(arrScores);
		arrSum(arrScores);*/
		
//		arrScores[STUDENTS] = 4;
		
		int[] arr = {1,2,3,4,5,6,7,8,9};
		System.out.println(arr.length);
		
		for(int i : arr){
			System.out.printf("%3d", i);
		}
	}

	private static void arrSum(int[] arrScores) {
		int sum = 0;
		for (int i = 0; i < arrScores.length; i++) {
			sum = sum + arrScores[i];
		}
		System.out.println("배열 arrScores의 요소들의 합은 " + sum);
	}

	private static void prnArray(int[] arrScores) {
		for(int i=0; i<arrScores.length; i++){
			System.out.print(arrScores[i] + "\t");
		}
		System.out.println();
	}
}
